import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:local_coffee/request/routers.dart';

class RqtVerificatioonCode {
  
  final Dio _dio;

  RqtVerificatioonCode(
    this._dio
  );

  /// 获取邮箱验证码
  /// ```
  /// @param {String} mail 邮箱
  /// ```
  Future<Response> getMailCode({
    @required String mail
  }) {
    return _dio.post(
      Routers.verificationMailGet,
      queryParameters: {
        'mail': mail
      }
    );
  }

  /// 获取邮箱验证码
  /// ```
  /// @param {String} code 验证码
  /// @param {String} mail 邮箱
  /// ```
  Future<Response> checkMailCode({
    @required String code,
    @required String mail
  }) {
    return _dio.post(
      Routers.verificationMailCheck,
      queryParameters: {
        'code': code,
        'mail': mail
      }
    );
  }
}